package com.myspring.web.collection;

import java.util.Arrays;
import java.util.List;

/**
 * @author : zenghua
 * @version : v0.1 ServiceType.java
 * @since : 2017/8/4 11:38
 */
public enum ServiceType {
	LIST("list"), SET("set"), MAP("map");

	String code;

	ServiceType(String code) {
		this.code = code;
	}

	public static ServiceType getType(String code) {
		List<ServiceType> types = Arrays.asList(ServiceType.values());
		for(ServiceType serviceType : types) {
			if (serviceType.getCode().equals(code)) {
				return serviceType;
			}
		}

		return null;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
}
